function [ OutputPath,  YieldPath, AcreagePath, LandUse, OutputDetail] = SimulationPathsLong(OldAgeStates, OldExoTimeStates, Pa, States,Boxes, pproc, theta_est, UHprob, opt )
%UNTITLED Summary of this function goes here
%   Detailed explanation goes here



for t = 1:150
    try 
        [NewAgeStates,NewExoTimeStates,NewPrice] = SimulationForward(Pa,OldAgeStates,States,OldExoTimeStates,Boxes,pproc,opt);
    catch
        [NewAgeStates,NewExoTimeStates,NewPrice] = SimulationForward(Pa,OldAgeStates,States,OldExoTimeStates,Boxes,pproc,opt);
    end
    %ProgressBar(t,150);
    TrackPrice.Sugar(t)       = NewPrice.Sugar;
    TrackPrice.OutReturn(:,t) = NewPrice.OutReturn';
    TrackAgeStates(:,t)       = NewAgeStates;
    OldAgeStates              = NewAgeStates;
    OldExoTimeStates          = NewExoTimeStates;
end
gamma = theta_est(1);
ActiveSugar = (TrackAgeStates > 2);
DecayFactor = zeros(size(TrackAgeStates));
DecayFactor(ActiveSugar) = gamma.^(TrackAgeStates(ActiveSugar) - 3);

Yields = States.MidPointsFixedStates(States.ExoFixedStates(:,2),2); % Potential yield idx;
Yields = bsxfun(@times,DecayFactor,Yields);
OutputDetail = mean(Yields(:,80:end),2);
LandUse      = mean(ActiveSugar(:,80:end),2);

Yields = bsxfun(@times,Yields,UHprob);
OutputPath  = sum(Yields,1);
YieldPath   = OutputPath./sum(bsxfun(@times,(Yields>0),UHprob),1);

AcreagePath = mean(bsxfun(@times,ActiveSugar,UHprob));




% ActiveSugar2 = (TrackAgeStates > 2 & TrackAgeStates <9);
% DecayFactor2 = zeros(size(TrackAgeStates));
% DecayFactor2(ActiveSugar2) = gamma.^(TrackAgeStates(ActiveSugar2) - 3);
% Yields2 = States.MidPointsFixedStates(States.ExoFixedStates(:,2),2); % Potential yield idx;
% Yields2 = bsxfun(@times,DecayFactor2,Yields2);
% Yield2Path  = OutputPath./sum((Yields2>0),1);

end

